require("../../assets/css/normalize.css");
require("../../assets/css/reset.css");
require("../../assets/fonts/iconfont.css");
require("./login.less");
// 引入模块
const dom = require("../../utils/dom.js");
const axios = require("axios");
document.addEventListener("DOMContentLoaded", function () {
	dom.get(".log-btn").addEventListener("click", function () {
		// 账号验证
		let tell = dom.get("#tel").value;
		let pwd = dom.get("#pwd").value;
		axios
			.post("http://fitness.h5.itsource.cn:3701/api/user/login", {
				account: tell,
				password: pwd,
			})
			.then((res) => {
				console.log(res);
				if (res.data.errno === 0) {
					localStorage.setItem("token", res.data.data.token);
					location.href = "index.html";
					wong.textContent = "登录成功";
				} else {
					wong.textContent = res.data.message;
				}
			});
	});
});
